﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MatTroi.vn.Models;
using System.Net;

namespace MatTroi.vn.Controllers
{
    public class TrangChuController : Controller
    {
        //
        // GET: /TrangChu/
        Entities db = new Entities();
        
        public ActionResult Index()
        {
            HomeViewModel h = new HomeViewModel();
           
            return View(h);
          
        }
        public ActionResult Category(int id)
        {
            MenuContent mn = new MenuContent();          
             var dm = db.tbl_DanhMuc.Find(id);
             var dmb = db.tbl_DanhMuc.Where(e => e.ID_DanhMuc == id && e.IsHot == true && e.ID_DanhMucCha == null).Take(1).ToList();
            var dmc = db.tbl_DanhMuc.Where(e => e.ID_DanhMucCha == id && e.IsHot == false).Take(6).ToList();
            mn.lstdm = dmb;
            mn.listDanhMuc = dmc;
            return View(mn);
        }
        
	}
}